<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
    export default {
        mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.Edit],
        components: {},
        data() {
            return {
                appWindow: window,
                editVisible: true,

                deliveryTime: "",
                createdTime: "",
                paymentTime: "",

                // 导出报表数据
                exportData: {
                    // 订单号
                    orderNo: {
                    type: String,
                    value: "",
                    default: "",
                    },
                    // 手机号
                    mobile: {
                    type: String,
                    value: "",
                    default: "",
                    },

                    // 客户昵称
                    nickName: {
                    type: String,
                    value: "",
                    default: "",
                    },

                    // 商品名称
                    productName: {
                    type: String,
                    value: "",
                    default: "",
                    },

                    // 收货人手机号
                    receiveMobile: {
                    type: String,
                    value: "",
                    default: "",
                    },

                    // 收货人
                    receiveName: {
                    type: String,
                    value: "",
                    default: "",
                    },

                    // 下单开始时间
                    createdTimeStartStr: {
                    type: String,
                    value: null,
                    default: null,
                    },

                    // 下单结束时间
                    createdTimeEndStr: {
                    type: String,
                    value: null,
                    default: null,
                    },

                    // 发货开始时间
                    deliveryTimeStartStr: {
                    type: String,
                    value: null,
                    default: null,
                    },

                    // 发货结束时间
                    deliveryTimeEndStr: {
                    type: String,
                    value: null,
                    default: null,
                    },

                    // 支付开始时间
                    paymentTimeStartStr: {
                    type: String,
                    value: null,
                    default: null,
                    },

                    // 支付结束时间
                    paymentTimeEndStr: {
                    type: String,
                    value: null,
                    default: null,
                    },

                    // 配送方式
                    deliveryType: {
                    type: Number,
                    value: 0,
                    default: 0,
                    },

                    // 订单状态
                    orderStatus: {
                    type: Number,
                    value: 0,
                    default: 0,
                    },

                    // 订单类型
                    orderType: {
                    type: Number,
                    value: 0,
                    default: 0,
                    },

                    // 支付渠道
                    payChannel: {
                    type: Number,
                    value: 0,
                    default: 0,
                    },

                    // 商品类型
                    productType: {
                    type: Number,
                    value: 0,
                    default: 0,
                    },
                },
            };
        },

        methods: {

            // 初始化
            async init() {

                
            },
            // 导出报表
            async exportTable() {
                let dataObj_ = {};
                for (const key in this.exportData) {
                    dataObj_[key] = this.exportData[key].value;
                }

                let res = await this.$vFN.Http.post(
                    {
                    url: "mall-site-portal/order/exportOrderList",
                    data: dataObj_,
                    }, window);

                if (res._ok) {
                    this.$vFN.Tools.messageSuccess("操作成功，请到下载中心查看");
                    this.editVisible = false;
                }
            },
            // 时间选择
            timeSelection(vaule, timeStartStr, timeEndStr){

            if(this.$vFN.Utils.isEmpty(vaule)){
                    timeStartStr.value = "";
                    timeEndStr.value   = "";
             }else{
                 // 开始时间
                timeStartStr.value = vaule[0];
                // 结束时间
                timeEndStr.value = vaule[1];
             }
    
            },

            // 清空导出筛选
            clearExport() {
                for (const key in this.exportData) {
                    this.exportData[key].value = this.exportData[key].default;
                }

                this.deliveryTime = "";
                this.createdTime  = "";
                this.paymentTime  = "";
            },

            // 提交成功
            onSubmitSuccess() {
                this.onSuccess();
            },
            // 成功回调
            onSuccess() {},
            // 取消回调
            onCancel() {},
            // 失败回调
            onError() {},

        },
        mounted() {
            this.init();
        },
        activated() {},
    };
</script>